using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using CR.Application.DTOs;
using CR.ErrorCode;

namespace CR.Application.Interfaces
{
    /// <summary>
    /// 溯源管理服务接口
    /// </summary>
    public interface ITraceabilityService
    {
        /// <summary>
        /// 获取所有溯源管理记录
        /// </summary>
        /// <returns>溯源管理记录列表</returns>
        Task<ApiResult<IEnumerable<TraceabilityManagementDTO>>> GetAllTraceabilityAsync();
        
        /// <summary>
        /// 根据ID获取溯源管理记录
        /// </summary>
        /// <param name="id">溯源管理ID</param>
        /// <returns>溯源管理记录</returns>
        Task<ApiResult<TraceabilityManagementDTO>> GetTraceabilityByIdAsync(int id);
        
        /// <summary>
        /// 根据溯源码获取溯源管理记录
        /// </summary>
        /// <param name="traceabilityCode">溯源码</param>
        /// <returns>溯源管理记录</returns>
        Task<ApiResult<TraceabilityManagementDTO>> GetTraceabilityByCodeAsync(string traceabilityCode);
        
        /// <summary>
        /// 创建溯源管理记录
        /// </summary>
        /// <param name="createDto">创建DTO</param>
        /// <returns>创建后的溯源管理记录</returns>
        Task<ApiResult<TraceabilityManagementDTO>> CreateTraceabilityAsync(TraceabilityCreateDTO createDto);
        
        /// <summary>
        /// 更新溯源管理记录
        /// </summary>
        /// <param name="id">溯源管理ID</param>
        /// <param name="updateDto">更新DTO</param>
        /// <returns>更新后的溯源管理记录</returns>
        Task<ApiResult<TraceabilityManagementDTO>> UpdateTraceabilityAsync(int id, TraceabilityUpdateDTO updateDto);
        
        /// <summary>
        /// 删除溯源管理记录
        /// </summary>
        /// <param name="id">溯源管理ID</param>
        /// <returns>操作结果</returns>
        Task<ApiResult> DeleteTraceabilityAsync(int id);
        
        /// <summary>
        /// 批量删除溯源管理记录
        /// </summary>
        /// <param name="ids">ID列表</param>
        /// <returns>操作结果</returns>
        Task<ApiResult> BatchDeleteTraceabilityAsync(IEnumerable<int> ids);
        
        /// <summary>
        /// 分页获取溯源管理记录
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns>分页结果</returns>
        Task<ApiResult<ApiPagin<TraceabilityManagementDTO>>> GetPagedTraceabilityAsync(TraceabilityQueryDTO query);
    }
} 